/*
 * Alvin Baldemeca
 * TCSS 305 - Spring 2012
 * Assignment 4 Power Paint
 */

package view.menu;


import javax.swing.Action;
import javax.swing.ButtonGroup;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JRadioButtonMenuItem;


/**
 * A class that creates a JMenuItem. 
 * @author Alvin Baldemeca
 *@version 5/10/2012
 */
@SuppressWarnings("serial")
public class ToolsMenu extends JMenu
{

  /**
   * The button group to put the radio button in the tool menu.
   */
  private final ButtonGroup my_group = new ButtonGroup();

  /**
   * Constructs a JMenu with the name Tools and Mnemonic 'T'.
   */
  public ToolsMenu()
  {
    super("Tools");
    setMnemonic('T');
  }
  
  /**
   * Creates a radio button for the tool menu.
   * @param an_action the action to attach to the button
   */
  public void createRadioButton(final Action an_action) 
  {
    final JRadioButtonMenuItem button = new JRadioButtonMenuItem(an_action);
    my_group.add(button);
    add(button);
  }
  
  /**
   * Creates a JMenuItem button for the tool menu.
   * @param an_action the action to attach to the button
   */
  public void createJMenuItemButton(final Action an_action) 
  {
    final JMenuItem button = new JMenuItem(an_action);
    my_group.add(button);
    add(button);
  }
 
}
